setScreenMetrics(1080, 2400);
auto.waitFor(); //
FloatyUtil(); //=悬浮窗加载===
init();
let 上传图片第一个位置 = true;
let width = device.width;
let height = device.height;
let _this = this;
let 记录运行时间 = 0;
let 极速版逛街 = false;
let 记录点击位置x = 0;
let 记录点击位置y = 0;
let dy = false;
let bz = false;
let xhs = false;
let wx = false;
let wxgz = false;
let jrtt = false;
let yd = false;
let zfb = false;
toastLog("版本23.11.18");
let 手动或默认确认 = true;
let storage = storages.create("1934017003@qq.com-renrenbang");
let 自动确定 = threads.start(function () {
  选择那些任务();
});
toastLog("8秒后自动确定");
sleep(8000);
if (手动或默认确认) {
  findAndClick("确定");
}
自动确定.interrupt();
toastLog("音量下关闭脚本");
let whichOne = 0;

threads.start(function () {
  findAndClick("允许|立即开始", 20000);
});
if (!requestScreenCapture()) {
  toast("请求截图失败");
  exit();
}

校验人人帮();
if (findAndClick(".天", 5000)) {
  findAndClick("确定", 5000);
} else {
  findAndClick("首页");
}

let 点拇指 = false;
let 点爱心 = false;
let 关注 = false;
console.error("====开始任务=====");
while (true) {
  if (xhs) {
    console.error("=====小红书任务====");
    校验人人帮();
    performAction("点爱心");
    performAction("关注");
    performAction("收藏");
  }
  if (dy) {
    校验人人帮();
    showFLog("====抖音任务====");
    douy();
  }
  if (bz) {
    showFLog("=====b站====");
    校验人人帮();
    bzhang();
  }
  if (wx) {
    showFLog("=====公众号助力====");
    校验人人帮();
    公众号助力();
  }
  if (wxgz) {
    showFLog("=====视频号助力====");
    校验人人帮();
    while (true) {
      点拇指 = findAndClickItem("点拇指");
      点爱心 = findAndClickItem("点爱心");
      关注 = findAndClickItem("关注");
      if (点爱心 && 关注 && 点拇指) {
        break;
      }
    }
  }
  if (jrtt) {
    let appName = "今日头条";
    if (app.getPackageName(appName) != null && jrtt) {
      今日头条("点爱心");
      今日头条("关注");
      今日头条("收藏");
    } else {
      log(appName + " 未安装");
    }
  }

  if (yd) {
    let nowTime = new Date().getTime();
    if (记录运行时间 == 0 || nowTime - 记录运行时间 > 61 * 60 * 1000) {
      校验人人帮();
      阅读();
      记录运行时间 = nowTime;
      校验人人帮();
      click(100, 100);
    }
  }

  if (zfb) {
    校验人人帮();
    findAndClick("支付宝助力");
    while (findAndClick("点击完成访问任务|浏览淘宝商家")) {
      sleep(2000);
      findAndClick("取消|入会.*");
      sleep(3000);
      back();
      sleep(1000);
      back();
      if (!findAndClick("确定")) {
        home();
        if (!findAndClick("焱焱有礼")) {
          showFLog("检测到桌面没有--自动添加焱焱有礼到桌面");
          校验人人帮();
          findAndClick("支付宝助力");
          findAndClick("更多");
          findAndClick("添加到桌面");
        }
      }
    }
  }
}

//==================微信=======
function bzhang() {
  processTask("关注");
  processTask("点拇指|点爱心");
}

function processTask(taskName) {
  if (findAndClick("哔哩哔哩助力")) {
    if (findAndClick(taskName)) {
      log("点击：" + taskName);
    } else {
      back();
      return log("没查询到结果");
    }
    sleep(2000);
    let 今日助力结果 = findAndClick("开始任务|.*10..");
    if (今日助力结果 && 今日助力结果.text() == "开始任务") {
      sleep(1000);
      if (校验离开人人帮()) {
        findAndClick("开始任务");
      }
      findAndClick("允许|打开|我知道了");
      if (taskName == "点拇指|点爱心") {
        let 点拇指 = widgetGetById("tv.danmaku.bili:id/frame_like");
        if (点拇指) {
          clickCenter(点拇指);
        } else {
          log("没有查询到点击爱心按键重新打开");
          findAndClick("允许|打开|我知道了");
          点拇指 = widgetGetById("tv.danmaku.bili:id/frame_like");
          if (点拇指) {
            clickCenter(点拇指);
          }
        }
      } else {
        if (!findAndClick("关注")) {
          findAndClick("允许|打开|我知道了");
          findAndClick("关注");
        }
      }
      截图();
      校验人人帮();
      if (人人帮上传()) {
        findAndClick("哔哩哔哩助力");
        人人帮上传();
      }
    }
  }
  back();
}

function 公众号助力() {
  if (findAndClick("公众号助力")) {
    while (findAndClick("关注|放弃任务", 8000, 2000)) {
      sleep(3000);
      let 放弃 = false;
      let 长按 = widgetGetById("qrCode");
      if (长按) {
        idAndClick("qrCode");
        文件传输方法();
        sleep(1000);
        toastLog("准备截图");
        截图();
        if (findAndClick("已关注公众号")) {
          findAndClick("不再关注");
        } else {
          back();
          sleep(1000);
          if (!widgetGetOne("已关注公众号")) {
            放弃 = true;
            wx = false;
            showFLog("微信公众号关注上限，退出任务");
          }
          截图();
        }
        sleep(2000);
        back();
        sleep(1000);
        back();
        if (放弃) {
          校验人人帮();
          findAndClick("放弃任务");
          back();
          sleep(2000);
          break;
        } else {
          sleep(1000);
          校验人人帮();
          if (人人帮上传()) {
            findAndClick("公众号助力");
            人人帮上传();
          }
        }
      } else {
        log("没有找到~~");
        back();
        break;
      }
    }
  }
}

function performAction(action) {
  swipe(width / 2, height / 2, width / 2, height / 5, 300);
  sleep(1000);
  if (findAndClick("小红书助力")) {
    if (widgetGetOne(".*完成")) {
      return 小红书(action);
    }
    sleep(1000);
    back();
  } else {
    back();
  }
}

function findAndClickItem(itemName) {
  findAndClick("视频号助力");
  let 点击任务 = findAndClick(".*" + itemName + ".*");
  if (点击任务 && 点击任务.text() == itemName) {
    return zuosm(itemName);
  } else {
    back();
    if (点击任务) {
      showFLog("任务需要等待，不做");
      wxgz = false;
    }
    return true;
  }
}

function zuosm(str) {
  sleep(3000);
  let 长按 = widgetGetOne("第一.*|.*10..");
  if (长按 && /第一/.test(长按.text())) {
    idAndClick("qrCode2");
    文件传输方法();
    // sleep(5000);
  } else {
    log("没有找到~~");
    back();
    return true;
  }
  sleep(3000);
  if (str == "关注") {
    clickElement("关注", 0);
  } else if (str == "点爱心") {
    clickElement("点爱心", 1);
  } else {
    clickElement("点拇指", 2);
  }

  截图(300);
  sleep(1000);
  //第二次点击取消掉点爱心 点拇指
  if (str == "关注") {
    findAndClick("已关注");
  } else {
    click(记录点击位置x, 记录点击位置y);
  }

  校验人人帮();

  if (人人帮上传()) {
    findAndClick("视频号助力");
    人人帮上传();
  }
  return false;
}

function 小红书(str, x) {
  x = x || 0;
  if (findAndClick(str)) {
    sleep(1000);
    let 今日助力结果 = alternativeWidget("开始任务", ".*10..", 8000, true);
    if (今日助力结果.value === 1) {
      if (开始任务()) {
        let strin = widgetGetOne(str, 12000);
        if (strin) {
          click(strin.bounds().centerX(), strin.bounds().centerY() - x);
        } else {
          if (str == "点爱心") {
            let 点赞 = widgetGetOne("点赞.*");
            if (点赞) {
              clickCenter(点赞);
            }
          }
          if (str == "收藏") {
            let 点赞 = widgetGetOne("收藏.*");
            if (点赞) {
              clickCenter(点赞);
            }
          }
        }
        截图();

        if (人人帮上传()) {
          findAndClick("小红书助力");
          人人帮上传();
        }
        return false;
      }
    } else if (今日助力结果.value === 2) {
      log("小红书没有任务");
    }
  }
  back();
  return true;
}

function 人人帮上传() {
  sleep(1000);
  if (currentPackage() != "com.bjwhx.and.renren") {
    console.error("打开错误，重新打开人人帮" + currentPackage());
    home();
    sleep(1000);
    校验人人帮();
  }
  if (!findAndClick("上传图片", 8000, 1000)) {
    console.error("没查询到上传图片重新查询");
    return true;
  }
  if (上传图片第一个位置) {
    let obj = findAndClick("weix.jpg.*");
    if (obj) {
      for (let i = 0; i < 4; i++) {
        if (obj && obj.clickable) {
          if (obj.click()) {
            console.log("Control clicked successfully");
            clickSuccessful = true;
          }
        } else {
          console.log("Control not clickable, checking parent");
          obj = obj && obj.parent();
        }
      }
    }
    sleep(1000);
    let zn = widgetGetOne("weix.jpg.*|确认提交");
    if (zn && zn.text() == "确认提交") {
      sleep(5000);
    } else if (zn) {
      findAndClick("weix.jpg.*");
      sleep(6000);
    }
    findAndClick("确认提交", 8000);
    return sleep(2000);
  }
  if (storage.get("上传方法") == undefined) {
    if (!findAndClick("weix.jpg")) {
      if (findAndClick("图片")) {
        sleep(2000);
        findAndClick("weix.*jpg");
        storage.put("上传方法", 1);
      } else {
        findAndClick("文件管理");
        sleep(1000);
        if (findAndClick("内部存储设备")) {
          storage.put("内部存储设备", 1);
        }
        sleep(1000);
        if (findAndClick("内部存储")) {
          storage.put("内部存储", 1);
        }

        findAndClick("atuping", 8000, 1000);
        findAndClick("weix.*jpg", 8000, 1000);
        if (findAndClick("确定")) {
          storage.put("确定", 1);
        }
        storage.put("上传方法", 2);
      }
    }
  } else if (storage.get("上传方法") == 1) {
    if (findAndClick("图片")) {
      sleep(2000);
      findAndClick("weix.jpg");
    }
  } else if (storage.get("上传方法") == 2) {
    findAndClick("文件管理");
    if (storage.get("内部存储设备") == 1) {
      findAndClick("内部存储设备", 8000, 1000);
    }
    if (storage.get("内部存储") == 1) {
      findAndClick("内部存储", 8000, 1000);
    }
    findAndClick("atuping", 8000, 1000);
    findAndClick("weix.*jpg", 8000, 1000);
    if (storage.get("确定") == 1) {
      findAndClick("确定", 8000, 1000);
    }
  }

  let 确认提交 = widgetCheck("确认提交");
  sleep(3000);
  clickCenter(确认提交);
  sleep(2000);
}

function 图片重置() {
  media.scanFile("/sdcard/atuping/weix.jpg");
  sleep(2000);
  // 创建一个Intent对象，设置其动作为扫描二维码
  var intent = new Intent();
  intent.setAction("com.tencent.mm.action.BIZSHORTCUT");
  intent.putExtra("LauncherUI.From.Scaner.Shortcut", true);
  log("截图成功");
  sleep(2000);
}

function 截图(waitTimes) {
  waitTimes = waitTimes || 1000;
  sleep(waitTimes);
  while (true) {
    if ((图 = images.captureScreen())) {
      files.create("/sdcard/atuping/");
      images.save(图, "/sdcard/atuping/weix.jpg", "jpg", 100);
      图片重置();
      sleep(500);
      return 图;
    }
  }
}

/**
 * 根据内容获取一个对象
 *
 * @param {string} contentVal
 * @param {number} timeout 默认超时时间5秒
 * @param {boolean} containType 是否带回类型
 * @param {boolean} suspendWarning 是否隐藏warning信息
 * @param {function} appendFilter 附加查询条件 详见UiSelector
 */
function widgetGetOne(contentVal, timeout, containType, suspendWarning, appendFilter, options) {
  let target = null;
  let isDesc = false;
  let waitTime = timeout || 8000;
  let timeoutFlag = true;
  showFLog(["try to find one: {} timeout: {}ms", contentVal.toString(), waitTime]);
  let checkResult = widgetCheck(contentVal, waitTime, true, appendFilter, options);
  if (!checkResult.timeout) {
    timeoutFlag = false;
    target = checkResult.target;
    isDesc = checkResult.isDesc;
  }
  // 当需要带回类型时返回对象 传递target以及是否是desc
  if (target && containType) {
    let result = {
      target: target,
      bounds: target.bounds(),
      isDesc: isDesc,
      content: isDesc ? target.desc() : target.text(),
    };
    return result;
  }
  return target;
}

/**
 * 替换控件搜索算法DFS,BFS,VDFS,VBFS,PDFS,PBFS,PVDFS,PVBFS
 * DFS,BFS为默认提供的深度优先和广度优先搜索算法
 * VDFS,VBFS为我修改的只搜索可见控件（控件包括父级不可见则直接跳过）深度优先和广度优先搜索算法 缺点是无法搜索不可见控件，适合一个界面中有巨量控件的时候用于加快搜索速度 实际数据抖音极速版从25s缩短到3s
 * PDFS,PBFS,PVDFS,PVBFS 是通过多线程搜索控件 大大加快搜索速度
 *
 * @param {string} algorithm 搜索算法DFS,BFS,VDFS,VBFS,PDFS,PBFS,PVDFS,PVBFS
 * @param {UiSelector} mselector
 * @returns
 */
function wrapSelector(algorithm, appendFilter, mselector) {
  appendFilter =
    appendFilter ||
    function (matcher) {
      return matcher;
    };
  mselector = appendFilter(mselector || selector());
  if (!algorithm) {
    return mselector;
  }
  // if (!algorithm_change_support) {
  //     log(['当前版本不支持替换搜索算法'])
  //     return mselector
  // }
  current = this.getCurrentAlgorithm();
  if (current == algorithm) {
    return mselector;
  }
  log(["替换搜索算法为：{} 原始算法：{}", algorithm, current]);
  return AlgorithmChanger.changeAlgorithm(mselector, algorithm);
}

/**
 * 查找一个子控件中的目标对象
 * @param {UiObject} container 父控件
 * @param {String} contentVal 控件文本
 * @param {number} timeout 超时时间 默认5秒
 * @param {Boolean} containType 返回结果附带文本是desc还是text
 * @param {function} appendFilter 附加查询条件 详见UiSelector
 * @param {Object} options 额外参数
 * 超时返回false
 */
function subWidgetGetOne(container, contentVal, timeout, containType, appendFilter, options) {
  options = options || {};
  timeout = timeout || 5000;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let matchRegex = new RegExp(contentVal);
  let isDesc = false;
  let isText = false;
  let target = null;
  let descThread = threads.start(function () {
    let descTarget = wrapSelector(options.algorithm, appendFilter).descMatches(matchRegex).findOneOf(container);
    if (descTarget) {
      log(["find desc {} {}", contentVal, descTarget.desc()]);
      isDesc = true;
      target = descTarget;
      countDown.countDown();
    }
  });

  let textThread = threads.start(function () {
    let textTarget = wrapSelector(options.algorithm, appendFilter).textMatches(matchRegex).findOneOf(container);
    if (textTarget) {
      log(["find text {} {}", contentVal, textTarget.text()]);
      isText = true;
      target = textTarget;
      countDown.countDown();
    }
  });

  let isTimeout = false;
  let timeoutThread = threads.start(function () {
    sleep(timeout);
    isTimeout = true;
    countDown.countDown();
  });

  countDown.await();
  descThread.interrupt();
  textThread.interrupt();
  timeoutThread.interrupt();
  if (isTimeout || (!isDesc && !isText)) {
    log("cannot find any matches " + contentVal);
  }
  if (target && containType) {
    return {
      isDesc: isDesc,
      target: target,
      bounds: target.bounds(),
      content: isDesc ? target.desc() : target.text(),
    };
  }
  return target;
}

/**
 * 查找一个子控件中的目标对象
 * @param {UiObject} container 父控件
 * @param {String} contentVal 控件id
 * @param {number} timeout 超时时间 默认5秒
 * @param {Boolean} containType 返回结果附带文本是desc还是text
 * @param {function} appendFilter 附加查询条件 详见UiSelector
 * @param {Object} options 额外参数
 * 超时返回false
 */
function subWidgetGetById(container, contentVal, timeout, containType, appendFilter, options) {
  options = options || {};
  timeout = timeout || 5000;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let matchRegex = new RegExp(contentVal);
  let isDesc = false;
  let isText = false;
  let target = null;
  let descThread = threads.start(function () {
    let descTarget = wrapSelector(options.algorithm, appendFilter).id(matchRegex).findOneOf(container);
    if (descTarget) {
      log(["find id {} {}", contentVal, descTarget.desc()]);
      isDesc = true;
      target = descTarget;
      countDown.countDown();
    }
  });

  let isTimeout = false;
  let timeoutThread = threads.start(function () {
    sleep(timeout);
    isTimeout = true;
    countDown.countDown();
  });

  countDown.await();
  descThread.interrupt();
  timeoutThread.interrupt();
  if (isTimeout || (!isDesc && !isText)) {
    log("cannot find any matches " + contentVal);
  }
  if (target && containType) {
    return {
      isDesc: isDesc,
      target: target,
      bounds: target.bounds(),
      content: isDesc ? target.desc() : target.text(),
    };
  }
  return target;
}

/**
 * 校验控件是否存在，并打印相应日志
 * @param {String} idRegex 控件文本
 * @param {String} position 日志内容 当前所在位置是否成功进入
 * @param {Number} timeoutSetting 超时时间 默认为 5秒
 */
function idWaiting(idRegex, position, timeoutSetting, appendFilter, options) {
  options = options || {};
  let waitingSuccess = idCheck(idRegex, timeoutSetting, false, appendFilter, options);
  position = position || idRegex;
  if (waitingSuccess) {
    log("等待控件成功：" + position);
    return true;
  } else {
    log("等待控件[" + position + "]失败， id：" + idRegex);
    return false;
  }
}

/**
 * id检测
 * @param {string|RegExp} idRegex
 * @param {number} timeoutSetting
 */
function idCheck(idRegex, timeoutSetting, containType, appendFilter, options) {
  options = options || {};
  let timeout = timeoutSetting || 5000;
  let timeoutFlag = true;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let target = null;
  let idCheckThread = threads.start(function () {
    target = wrapSelector(options.algorithm, appendFilter).idMatches(idRegex).findOne();
    log("find id " + idRegex);
    timeoutFlag = false;
    countDown.countDown();
  });

  let timeoutThread = threads.start(function () {
    sleep(timeout);
    countDown.countDown();
  });
  countDown.await();
  idCheckThread.interrupt();
  timeoutThread.interrupt();
  if (timeoutFlag) {
    log(["未能找到id:{}对应的控件", idRegex]);
  }
  if (containType) {
    return {
      timeout: timeoutFlag,
      target: target,
      bounds: target ? target.bounds() : null,
    };
  }
  return !timeoutFlag;
}

/**
 * 校验控件是否存在
 * @param {String} contentVal 控件文本
 * @param {Number} timeoutSetting 超时时间 单位毫秒
 * @param {Boolean} containType 返回结果附带文本是desc还是text
 * @param {Object} options 额外参数
 * 超时返回false
 */
function widgetCheck(contentVal, timeoutSetting, containType, appendFilter, options) {
  options = options || {};
  let timeout = timeoutSetting || 5000;
  let timeoutFlag = true;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let matchRegex = new RegExp(contentVal);
  let isDesc = false;
  let target = null;
  let descThread = threads.start(function () {
    target = wrapSelector(options.algorithm, appendFilter).descMatches(matchRegex).findOne();
    let res = target.desc();
    log("find desc " + contentVal + " " + res);
    timeoutFlag = false;
    isDesc = true;
    countDown.countDown();
  });

  let textThread = threads.start(function () {
    target = wrapSelector(options.algorithm, appendFilter).textMatches(matchRegex).findOne();
    let res = target.text();
    log("find text " + contentVal + "  " + res);
    timeoutFlag = false;
    countDown.countDown();
  });

  let timeoutThread = threads.start(function () {
    sleep(timeout);
    countDown.countDown();
  });
  countDown.await();
  descThread.interrupt();
  textThread.interrupt();
  timeoutThread.interrupt();
  if (timeoutFlag) {
    log("cannot find any matches " + contentVal + " timeout:" + timeout);
  }
  if (containType) {
    return {
      timeout: timeoutFlag,
      target: target,
      bounds: target ? target.bounds() : null,
      isDesc: isDesc,
    };
  }
  return !timeoutFlag;
}

/**
 * 校验控件是否存在，并打印相应日志
 * @param {String} contentVal 控件文本
 * @param {String} position 日志内容 当前所在位置是否成功进入
 * @param {Number} timeoutSetting 超时时间 单位毫秒 默认为_config.timeout_existing
 */
function widgetWaiting(contentVal, position, timeoutSetting, appendFilter, options) {
  options = options || {};
  let waitingSuccess = widgetCheck(contentVal, timeoutSetting, false, appendFilter, options);
  position = position || contentVal;
  if (waitingSuccess) {
    log("等待控件成功：" + position);
    return true;
  } else {
    log("等待控件[" + position + "]失败, 查找内容：" + contentVal);
    return false;
  }
}

/**
 * 根据id获取控件信息
 * @param {String|RegExp} idRegex id
 * @param {number} timeout 超时时间
 * @return 返回找到的控件，否则null
 */
function widgetGetById(idRegex, timeout, appendFilter, options) {
  options = options || {};
  timeout = timeout || 8000;
  let target = idCheck(idRegex, timeout, true, appendFilter, options);
  if (!target.timeout) {
    return target.target;
  } else {
    return null;
  }
}

function waitFor(action, timeout) {
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let actionSuccess = false;
  let actionThread = null;
  let that = this;
  try {
    let start = new Date().getTime();
    actionThread = threads.start(function () {
      try {
        action();
        actionSuccess = true;
      } catch (e) {
        if (e.javaException instanceof com.stardust.autojs.runtime.exception.ScriptInterruptedException) {
          return;
        }
        warn("action执行异常" + e);
        that.printExceptionStack(e);
      } finally {
        countDown.countDown();
      }
      log(["action执行结束: {} 耗时：{}ms", actionSuccess, new Date().getTime() - start]);
    });
    let waitResult = countDown.await(timeout, java.util.concurrent.TimeUnit.MILLISECONDS);
    log(["waitFor方法执行完毕，action result: {}, wait result: {} cost time: {}ms", actionSuccess, waitResult, new Date().getTime() - start]);
    if (!waitResult) {
      log(["等待操作超时, 操作时间: {}ms", new Date().getTime() - start]);
    }
  } catch (e) {
    this.printExceptionStack(e);
  } finally {
    if (actionThread !== null) {
      actionThread.interrupt();
    }
  }
  return actionSuccess;
}

// let result = widgetUtils.alternativeWidget(/\s*今日签到\s*/, '.*明早7点可领.*', null, true)
// if (result.value === 1) {
/**
 * 判断控件A或者控件B是否存在；超时返回0 找到A返回1 否则返回2
 *
 * @param {string|regex} contentA 控件A的内容
 * @param {string|regex} contentB 控件B的内容
 * @param {number} timeout 超时时间
 * @param {boolean} containContent 是否传递实际内容
 * @param {function} appendFilter 附加查询条件 详见UiSelector
 * @param {object} options 额外参数
 * @return 超时返回0 找到A返回1 否则返回2
 */
function alternativeWidget(contentA, contentB, timeout, containContent, appendFilter, options) {
  options = options || {};
  timeout = timeout || _config.timeout_existing;
  let timeoutFlag = true;
  let countDown = new java.util.concurrent.CountDownLatch(1);
  let matchRegexA = new RegExp(contentA);
  let matchRegexB = new RegExp(contentB);
  let isDesc = false,
    findA = false;
  let res = null,
    target = null;
  let descThreadA = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).descMatches(matchRegexA).findOne();
    res = target.desc();
    log("find desc " + contentA + " " + res);
    timeoutFlag = false;
    isDesc = true;
    findA = true;
    countDown.countDown();
  });

  let textThreadA = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).textMatches(matchRegexA).findOne();
    res = target.text();
    log("find text " + contentA + "  " + res);
    timeoutFlag = false;
    findA = true;
    countDown.countDown();
  });
  let descThreadB = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).descMatches(matchRegexB).findOne();
    res = target.desc();
    log("find desc " + contentB + " " + res);
    timeoutFlag = false;
    isDesc = true;
    countDown.countDown();
  });

  let textThreadB = threads.start(function () {
    target = _this.wrapSelector(options.algorithm, appendFilter).textMatches(matchRegexB).findOne();
    res = target.text();
    log("find text " + contentB + "  " + res);
    timeoutFlag = false;
    countDown.countDown();
  });

  let timeoutThread = threads.start(function () {
    sleep(timeout);
    countDown.countDown();
  });
  countDown.await();
  descThreadA.interrupt();
  textThreadA.interrupt();
  descThreadB.interrupt();
  textThreadB.interrupt();
  timeoutThread.interrupt();
  if (timeoutFlag) {
    log(["cannot find any matches {} or {}", contentA, contentB]);
  }
  // 超时返回0 找到A返回1 否则返回2
  let returnVal = timeoutFlag ? 0 : findA ? 1 : 2;
  if (containContent) {
    return {
      target: target,
      bounds: target ? target.bounds() : null,
      content: res,
      value: returnVal,
    };
  } else {
    return returnVal;
  }
}

// 快速打开("快手极速", "com.kuaishou.nebula", "com.yxcorp.gifshow.HomeActivity")
/**
 * 找到并且点击 如果返回错误就点击中心 返回一个布尔值
 * @param {str} 要找的字符串
 */
function findAndClick(str, sleepTime, waitSleep) {
  waitSleep = waitSleep || 100;
  sleep(waitSleep);
  sleepTime = sleepTime || 8000;
  let widgetGet = widgetGetOne(str, sleepTime);
  if (widgetGet) {
    clickView(widgetGet);
    return widgetGet;
  }
  return false;
}
function clickView(obj) {
  try {
    let clickSuccessful = false;
    let originalObj = obj; // 保存最初的控件
    if (originalObj) {
      if (clickCenter(originalObj)) {
        return;
      } // 点击最初的控件的中心位置
    }
    for (let i = 0; i < 4; i++) {
      if (obj && obj.clickable) {
        if (obj.click()) {
          console.log("Control clicked successfully");
          clickSuccessful = true;
        }
      } else {
        console.log("Control not clickable, checking parent");
        obj = obj && obj.parent();
      }
    }

    sleep(500);
  } catch (error) {
    console.error("按键点击失败：" + error);
  }
}
function clickCenter(obj) {
  sleep(300);
  if (obj.bounds().centerX() > width || obj.bounds().centerY() > 2200 || obj.bounds().centerX() < 0 || obj.bounds().centerY() < 0) {
    showFLog("不可点击范围:" + obj.bounds().centerX() + " " + obj.bounds().centerY());
    return false;
  }
  showFLog(obj.text() + " 点击位置：" + Number(obj.bounds().centerX()) + " " + Number(obj.bounds().centerY()));
  click(Number(obj.bounds().centerX()), Number(obj.bounds().centerY()));
  sleep(500);
  return true;
}
// 杀死后台
function killApp(appName) {
  var name = getPackageName(appName); //通过app名称获取包名
  if (null == name) {
    console.error("没有查询douyjsb");
    return true;
  }
  app.openAppSetting(name); //通过包名打开应用的详情页(设置页)
  sleep(2000); //稍微休息一下，不然看不到运行过程，自己用时可以删除这行
  findAndClick(/强.*|停.*|结.*/);
  findAndClick(/强.*|停.*|结.*/);
  findAndClick(/.*确.*|.*定.*/);
  sleep(3000);
  return false;
}

function douy() {
  findAndClick("抖音助力");
  if (findAndClick("关注")) {
    let 复制链接 = findAndClick("复制链接|.*10..");
    if (复制链接 && 复制链接.text() == "复制链接") {
      clickCenter(复制链接);
    } else {
      back();
      return log("当前抖音没有关注任务");
    }
    sleep(3000);
    if (!launchApp("抖音")) {
      if (!launchApp("抖音极速版")) {
        launchApp("抖音火山版");
      }
    }
    sleep(5000);
    if (!findAndClick("允许|打开看看|打开", 8000)) {
      findAndClick("允许|打开");
    }
    if (!widgetCheck("关注")) {
      findAndClick("允许|打开看看|打开");
      findAndClick("允许|打开");
    }
    findAndClick("关注");
    sleep(3000);
    findAndClick("关注");
    sleep(1000);
    // let 关注位置 = findAndClick("关注");
    if (!widgetGetOne("已关注")) {
      showFLog("没查询到已经关注，用找图");
      const 抖音关注图片 =
        "data:image/png;base64," +
        "iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAYAAADE6YVjAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAUBSURBVEiJPZbNbtQ8G4YvO06c/zICCYkKV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ld2utUzpM00SWZYQQkhmV9579fs+6rtR1TTSnlDIZTQiRfhdCsN/vyfOcoiiY5xlrbQrSPM+ZpgnvPW3bnszY9z3e+yRB7z2HwwHvfQrImFnR4VHqceplWVLW7fd7NpsN3nuGYaBpGtQ0TczzTFmWjOOIlJKmaViWhXme2Ww2CCFSTMQkjv0TMy2aOCYzQAjhlMJFUeC9Z5qmFITjOKK1pm1bjDHkeU6WZcmcTdMkOa/rmjaOTToMA1prXrx4ceJmt9vhnKPruoRplmXUdY21Nsl3v99jrU1TxlqIlxljEEIwDAN5nic4x3FEnZ2dsSwL0zQlpUQOYvrGLPPep/aL7Rl56roO733isCgK8jw/9U6cPoZjjPhorki0MQatNVmWpWiP54Ak1+iXEAJKKQ6HAzLCEMsq1mtsvjzP+f37N3/+/OHp6Ylfv35xd3eXvk5ii87zjNaaqqrSV0+MfNX3PeM4cnZ2xm63S0qLqyuluLm5wRjD+fk59/f3PD09pUEiPFprjDHpTMy8qqpOpdV1HbvdDiDp3jmXLtNac3t7y+3tbSovrTXH45F1XZO8Aay1VFWVIF2Whf8BXel/PlBzySoAAAAASUVORK5CYII=";

      找图(抖音关注图片);
    }
    if (!widgetGetOne("已关注")) {
      console.error("这货估计在直播");
      let 本场点赞 = widgetGetOne(".*本场点赞");
      if (本场点赞) {
        click(80, 本场点赞.bounds().centerY());
        findAndClick(".*的头像");
        findAndClick("关注", 8000, 1000);
      }
    }
    截图();
    sleep(2000);
    if (findAndClick("已关注")) {
      findAndClick("取消关注");
      back();
      sleep(500);
    }
    back();
    sleep(3000);
    校验人人帮();
    if (人人帮上传()) {
      findAndClick("抖音助力");
      人人帮上传();
    }
  }
  back();
}
function listChoose() {
  let option = dialogs.singleChoice("请选择-下滑还有哦", wChooseList);
  if (option == -1) {
    toastLog("脚本已退出");
    exit();
  }
  let whichOne = chooseList[option];
  return whichOne;
}
function swipex(speed) {
  let millis = parseInt(speed || 500);
  let x = parseInt(width / 2);
  let startPoint = height - 150;
  // 滑动距离，二分之一屏幕
  let distance = parseInt(height - 200);
  let endPoint = startPoint - distance;
  // 手势上划
  swipe(x, startPoint, x + 100, endPoint, millis);
}

function 滑动返回(nums) {
  let num = 20 || nums;
  sleep(3000);
  for (var i = 0; i < num; i++) {
    sleep(3000);
    let 阅读 = widgetGetOne("已无更多数据|写留言|收藏|任务中心");
    if (阅读 && 阅读.bounds().top < 2400) {
      log(阅读);
      sleep(1000);
      break;
    }
    swipex();
    log("滑动：" + i);
  }
  back();
}
function getImg(x1, y1, x2, y2) {
  log(x1, y1, x2, y2);
  var screen = images.captureScreen();
  var img = images.clip(screen, x1, y1, Number(x2 - x1), Number(y2 - y1));
  images.save(img, "/sdcard/微信.jpg", "jpg");
  img.recycle();
  toastLog("截图完成");
}

function 处理开心收下(开心收下) {
  clickCenter(开心收下);
  sleep(1000);
  if (开心收下 && 开心收下.text() == "开心收下") {
  } else if (开心收下) {
    let 等待时间 = widgetGetOne(".*后可领奖励");
    等待并返回(等待时间);
    let 开心收下1 = widgetGetOne("开心收下|领取奖励");
    log(开心收下1);
    if (开心收下1) {
      处理开心收下(开心收下1);
    }
  }
}
function 等待并返回(等待时间) {
  if (等待时间) {
    sleep(Number(等待时间.text().replace(/[^\d]/g, "")) * 1000);
    back();
    sleep(1000);
    back();
  }
}
function 开宝箱() {
  let 开宝箱得金币 = className("com.lynx.tasm.behavior.ui.view.UIView").text("开宝箱得金币").findOne(8000);
  log(开宝箱得金币);
  if (开宝箱得金币) {
    clickCenter(开宝箱得金币, 0, -100);
    sleep(1000);
    click(600, 1500);
    let 等待时间 = widgetGetOne(".*后可领奖励");
    等待并返回(等待时间);
    let 开心收下 = widgetGetOne("开心收下|领取奖励");
    log(开心收下);
    开心收下 ? 处理开心收下(开心收下) : "";
  }
}
function 逛街() {
  if (findAndClick("逛街赚钱")) {
    while (widgetGetOne(".*秒")) {
      sleep(5000);
      swipex();
    }
    back();
  } else {
    return true;
  }
}

function swipex(speed) {
  let millis = parseInt(speed || 500);
  let x = parseInt(width / 2);
  let startPoint = height - 150;
  // 滑动距离，二分之一屏幕
  // let distance = parseInt(height / 2 - 200);
  let endPoint = parseInt(height / 2 - 200);
  // 手势上划
  swipe(x, startPoint, x, endPoint, millis);
}

function 抖音极速版逛逛() {
  let nowTime = new Date().getTime();
  if (极速版逛街 && (记录运行时间 == 0 || nowTime - 记录运行时间 > 660000)) {
    if (killApp("抖音极速版")) {
      极速版逛街 = false;
      return;
    }
    app.startActivity({
      data: "snssdk2329://search/trending?type=1",
    });
    sleep(3000);
    back();
    let idCheck = id("com.ss.android.ugc.aweme.lite:id/fqh").findOne(8000);
    if (idCheck) {
      clickCenter(idCheck);
    }
    开宝箱();
    idCheck = id("com.ss.android.ugc.aweme.lite:id/fqh").findOne(8000);
    if (idCheck) {
      clickCenter(idCheck);
    }
    console.hide();
    if (逛街()) {
      极速版逛街 = false;
      console.error("不在运行极速版任务");
    }
    back();
    sleep(1000);
    back();
    记录运行时间 = nowTime;
  }
  校验人人帮();
}
function 校验人人帮() {
  console.info("当前apppackage：" + currentPackage());
  if ("com.bjwhx.and.renren" != currentPackage()) {
    log("打开人人帮");
    launchApp("人人帮");
  }
}
function 校验离开人人帮() {
  console.info("校验离开人人帮,当前apppackage：" + currentPackage());
  if ("com.bjwhx.and.renren" == currentPackage()) {
    return true;
  }
}
function showFLog(msgLog) {
  let str = msgLog + " ";
  setInfo(str);
  log(msgLog);
}
//================悬浮窗开始================
function FloatyUtil() {
  this.floatyWindow = null;
  this.floatyInitStatus = false;
  this.floatyLock = threads.lock();
  this.floatyCondition = this.floatyLock.newCondition();
}

function init() {
  if (this.floatyInitStatus) {
    return;
  }
  let _this = this;
  threads.start(function () {
    _this.floatyLock.lock();
    try {
      if (_this.floatyInitStatus) {
        return;
      }
      _this.floatyWindow = floaty.rawWindow(
        <frame gravity="left">
          <text id="content" textSize="16dp" textColor="#00ff00" />
        </frame>
      );
      ui.run(function () {
        _this.floatyWindow.setTouchable(false);
        _this.floatyWindow.setPosition(50, 150);
        _this.floatyWindow.content.text("悬浮窗初始化成功");
      });
      _this.floatyInitStatus = true;
    } catch (e) {
      console.error("悬浮窗初始化失败" + e);
      _this.floatyWindow = null;
      _this.floatyInitStatus = false;
    } finally {
      _this.floatyCondition.signalAll();
      _this.floatyLock.unlock();
    }
  });
  _this.floatyLock.lock();
  try {
    if (_this.floatyInitStatus === false) {
      console.info("等待悬浮窗初始化");
      _this.floatyCondition.await();
    }
  } finally {
    _this.floatyLock.unlock();
  }
}

function setInfo(text, position, option) {
  option = option || {};
  if (this.floatyWindow === null) {
    this.init();
  }
  let _this = this;
  ui.run(function () {
    _this.floatyLock.lock();
    try {
      if (position && isFinite(position.x) && isFinite(position.y)) {
        _this.floatyWindow.setPosition(parseInt(position.x), parseInt(position.y) + 100);
      }
      if (text) {
        _this.floatyWindow.content.text(text);
      }
      if (option.textSize) {
        _this.floatyWindow.content.setTextSize(option.textSize);
      }
      if (typeof option.touchable !== "undefined") {
        _this.floatyWindow.setTouchable(option.touchable);
      }
    } finally {
      _this.floatyLock.unlock();
    }
  });
}
function clickElement(elements, index) {
  showFLog("点击：" + elements);
  if (index == 0) {
    findAndClick("关注");
  } else if (index == 1) {
    const 微信爱心图片 =
      "data:image/png;base64," +
      "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAABHaSURBVGiBZZpbjFx1Hcc/536Z286SxkijDxIeIEa80NSmULLQ0sUtNShpCIlvSLWGi7S2YFuyMeGBxBhifPbNBxMe1FdNrA1VtBYIki3S3Xa7WFpKd+dy5pyZc/dh+f2Y1U2a7szOnPP//y7fy+9/DMMw6rqu6XQ6RFGEZVmUZYnjOJimiWEY2LYNgGEYjEYjDMOgLEs8z6MsS6qqoqoqLMui1WpRVRWmaTIajXAcB9u2ieOYRqNBXddUVUVRFGRZRqPRYDKZYBgGrVaLsiyZTCaEYUiapjiOQxRFNBoNqqpiPB7TbDbJ85wgCOj3+zQaDQzf92v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qumb37t18/PHHLC0tKbxPD8Udx+HRRx/lxIkTVFWl9mEymfDUU09x6dIlLUWpCDF4AseyXsvzvEUZtYgzExMjFxW9JE5vWgEIIvV6Pf7+97/z6KOPKtJlWcbOnTt10i+ZlhHP3Nwcx44dU5foOA7D4ZBjx47x4YcfKpPLpH56qimfl2BbhmEsOo6jjyYJp0j5yOBsOBxuOZkS4yOPRLmuS7/f5/z58zz00EM6RKiqioWFBT766CPW1tY0EI899hjPPvvs5tnGp3oqyzIOHz7MjRs3dBL/vwglz624rrvlUaj/Ar4oMG+03sJ6AAAAAElFTkSuQmCC";

    找图(微信爱心图片);
  } else {
    const 微信大拇指图片 =
      "data:image/png;base64," +
      "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAA9aSURBVGiBZVo9qx1VG12zZ2bP98y5V41GBCVFUEExpbVgIUkhNoqVWAlqilRi8xZBgpWdqI3/wEJU7GwU5RKrCCkUU0RRMeec+Z7Z87Hf4roez33fQJr7MWfP86xnrfWsfZ0gCGwYhuj7HtZaTNOENE3Rti0AwPd9aK0xDAMcx0EQBHAcBwCwriv6vkeWZajrGkopuK4L3/fhui6macI8z5imCa7rIs9zvPrqq3j55ZexLAuUUvA8D67r4vvvv8eNGzew3+/hOA5c18U8z3AcB77vo65rRFGEcRyRJAmmaULbtnBdF47jwFFK2SRJ4DgOmqaBtRZaa2itMc+zvFwQBDDGwHVdOaTneZjnGWEYwnEcdF2HZVkQhiFc1wUAtG2LzWaDaZpw9epVPPfcc3BdV17aGIPNZoO2bVGWJd544w3cu3cP67oCAJZlOT2o40BrjXEc4fs+pmlCHMeY55lFVGjbFk3TAADCMESSJPLDrutiXVf4vo88zzGOIxzHQRRF6PseSinUdY1xHKUbrNYwDLDWwhiDJ554ApcvX4brugjDEGEYYp5n+L6Pvu+htcaDDz6IGzduIIoiGGPgeZ6cwRiDuq7heR6UUhiGAX3fY13X065qrf/D6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ZMKTERQA6TL3DRJIURQSH9GdM91X/AbVmVRJW02+54sdrrCsLjtEfg+CQMSrLEthMH7OYWpCf8cOUkd4/UZ2pCtgWBLHsYi0tRYe54B2nmzTNI18EIePlzjUhLZtkaYp7t27hyzLpMJJkmC320lss9/vz2x4nudhs9lIQVgs0jCpmC/ApWtZFux2O0kdSTBZluG/oqtotSJLgVEAAAAASUVORK5CYII=";

    找图(微信大拇指图片);
  }
}
function 选择那些任务() {
  let 选择的任务 = [];
  let storage = storages.create("1934017003@qq.com-renrenbang");
  if (storage.get("任务-美添赚")) {
    选择的任务 = storage.get("任务-美添赚");
  } else {
    选择的任务 = [1, 2, 3, 4, 5];
  }
  let items = ["抖音", "B站", "小红书", "微信关注公众号", "微信文章点赞关注收藏", "今日头条", "微信阅读", "支付宝关注任务"];
  dialogs.multiChoice("请选择需要跑的选项", items, 选择的任务, (indexArr) => {
    选择的任务 = [];
    选择的项目 = [];
    indexArr.forEach((v) => {
      选择的任务.push(v);
      选择的项目.push(items[v]);
    });
  });
  log(选择的项目);
  if (选择的任务.length > 0) {
    storage.put("任务-美添赚", 选择的任务);
    选择的任务.forEach((v) => {
      if (v == 0) dy = true;
      if (v == 1) bz = true;
      if (v == 2) xhs = true;
      if (v == 3) wx = true;
      if (v == 4) wxgz = true;
      if (v == 5) jrtt = true;
      if (v == 6) yd = true;
      if (v == 7) zfb = true;
    });
    手动或默认确认 = false;
  } else {
    showFLog("一个都没选择 退出脚本");
    exit();
  }
}

function 找图(str, loop) {
  var screen;
  try {
    if (typeof loop === "undefined") {
      loop = 3;
    }
    screen = images.captureScreen();
    screen = images.cvtColor(images.grayscale(screen), "GRAY2BGRA");
    var p = findImage(screen, images.fromBase64(str), { threshold: 0.6 });
    if (p) {
      toastLog("找到啦:" + p);
      let num = p.toString().replace(/{|}/g, "");
      let nums = num.split(",");
      click((nums[0] * 10) / 10, (nums[1] * 10) / 10);
      log("点击坐标：" + (nums[0] * 10) / 10 + " " + (nums[1] * 10) / 10);
      return true;
    } else if (loop-- > 1) {
      sleep(1500);
      log("没查询到开始倒数第:   " + loop + " 找图");
      return 找图(str, loop);
    } else {
      toastLog("没找到，找图失败");
      return false;
    }
  } finally {
    if (screen) {
      screen.recycle();
    }
  }
}

function 今日头条(str) {
  const 头条爱心图片 =
    "data:image/png;base64," +
    "iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAVSSURBVGiB7Zo9U/JMFIbv552nTZ4eUmEDNFgBhaMN0KAN0GiFFVTQADZaSaM0YiUNWGnBR6MWEhttjFY2gD8g2rv5AXkLhozJJiGEBD/vGWfczebMudjPczZ/ZFmW8YP030c7sGj9OOC/87xMCAHP83h5eYEgCACAt7c3/Pv3DxzHgeM4xGIxBINByzaHwyFubm4giiJEUVTsAUA0GoXX60U8HgfLsrZ8/mNnDne7XXS7XTw8PFhq7/V6kclkkM1mdR0lhOD09BSdTgcvLy+WbEYiEaTTaaTT6Zl8nwlYEAQcHx9bBtWKYRgUi0Vsb28rda1WC/V6HZIk2bIZiURQKBQQjUYttbcMXK1W0Wq1bDmlVSAQwMnJCfL5PEajkSM2t7e3sbu7O7XdVGBCCCqVCniep555PB4kEgnE43HqFxZFEYIgoNvt4vHx0bLjsVhMscdxnOqZIAjgeR79fh+vr6/Uu/F4HIeHh6bzeyrw+vo61QsejwfFYhGZTMYSxHA4xP7+vil4OBzG3t6e5QWu0+mgXq9T4IFAAJeXl8YvyiYql8uyz+dT/ZVKJbNXTNVut+VQKKSyFwqF5Ha7bdtmqVSifCyXy4btDYGbzSZlqNls2nZsosFgIK+srMg+n09eWVmRB4PB3DaPjo4oX41+RN0hTQjB6uqqauXMZrPY29uzNNymiRCC4XCIYDBoez/Vqlwuo9frKWWGYXB3d0fZ1z1ptVotFexkfjkllmURjUYdgwWAWq2GcDislCVJ0t1VqB7W693b21tqxfyMEkURa2trSlmvl6ke7vf7KthUKvUlYAGA4zikUimlLEkS+v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5+TneiJOAWq0WOkAl3aaJFABoNpuho3fWIRlCSKpigRgRjzDRtm0nrjgKwfL3FQvEDPE0m81Iy7csUBQlld3G2DGtzz8uvpKo0ZZdxBIc7GJZx5CD5TuOs3eZsQQHf538eMHB7pz10YVg+Wl8Tnt16aw3soMOpzErJHZYEITMwz6yLHNBiTQcjnWo5XOFiqJEzkcpxWg0wnK5hCAIaDQakV+WoiirwN2XCk7SnTfFuDudTuRYcj6f5yKVtm3vdVogcpeOM0L7QjVN2xjQN00Tmqah1+ttDS4E6wm2Iy6RBQe7U1iX/iyUEMLtF4WxXC5BCNkqPFjPvt06td3D0WiEWq22UWi9XodlWajX62vPfOG1Wi3RrkccEp/E63Q6uLu7g+u6IIRsfPP1eh2tVmvVNVVVRavVAiFkbS/J8zy0220QQlZ5gpts+84MkbdLgxveuygWi2i1WlsHGNu2QQjZun0SZN8N88hdWpZlGIaxM12xWIRlWej3+ztHU1VV0e/3YVkWisXizrINw9h/ORs3RDIYDEJDLuVymU0mk0RhF5/JZMLK5fJa2YVCIXFIJ0iiMx6UUpimCUopRFFEqVRK9SSdbduYTqeglEKW5VgLlV1kepr2EMnscOmh8iv4p/Mr+KfzK/in8yv4p/PPCf4L/dWC/7vquBsAAAAASUVORK5CYII=";
  const 头条收藏图片2 =
    "data:image/png;base64," +
    "iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAB44SURBVHicpV3ZjxxX+T1VXb1P9yye8TLjZZDAxkhGSQQvLI4DKBIOL4CIlCf+Ah5ZhISUN14i8YgQwYtkKcaSIQZjByQTEmHFxCAlRERxvGRsi3ib8ey9V9XvoXOuT31T1T3m90mj6umuunXvud8933Jv3fK+973vxfl8HqVSCbVaDSMjIyiXy8jn8/B9H0EQIAgC5PN5AEAcx+j1euh2u2i322g0Gmg2m+h2u4iiCPl8HsViEYVCAblcDmEYotlsYmFhAfPz81hdXUUQBJiYmMDk5CSmpq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W7T4moPme1WYIm00GqhUKhsmZFX79YY2UW4DFII9Pz+PU6dO4a233nKvKanVaiiXy/B9322gxaW03I7y7NmzOH36NJ599ll8//vfBw28gsWRorvSUJGAZE47TUlWV1fheZ6zVUxZUPloBC3AkvHrn8SK0fdjDzPRz17sdDq4ffs29u3blwB0EFdrZ6gh4T2bzSYuXLiAc+fOodVqufez8N5UAr7UoNfrYW1tDWtrawnLf+HCBbz++ut47rnn8MILL2Dbtm0ORM2J0PYo2MrRaXL9+vUEVfBPM3u6MklZwfO8/lsrdPkXe4HgcTod6Geo1tfXcf36dezbt8+dr1zEimf519o5BPjixYsIw9C9joMN59Q+h2ihUHBvM1pZWUGr1UqsGSSof//733H16lUcPHgQzzzzDLZv357wiuwkA6+jWDqL4xgXL17cMBK1za1WyxlcdWVZdrCysuL8Zg0/lU/1FUjdbhevv/46Dh065HYwTJv6SjOS/NxoNHDu3DmcP38e3W4XIyMjbiksR5c+gcBR0Gg03LJYfY5Ehfd98OABTp06hYsXL+L55593G8Cy4TYfTtrgZwX74cOHuHHjBmq1muN2rZudlbKd4fs+cjt27HhR36jDHg/DMLEih8MijmPnoezfv98VbP1klmM9jT/+8Y/4xS9+gffee885/mys9UHpvzcaDayvr4N5GRo0UptaeQLE4dxut/Gf//wH//rXvzA6OoqZmZmEdzPI62CdT506hZs3b7ogjqtKuT6angjrklan3Pj4+IutViuR6ut0Ou6JTyV9BTvtCQCtIHuSN3rzzTfx0ksv4dKlSwnLzvJ0r30aLFLEwsICVldX0Wg00Ov1Ei/nSRvKzA8z9cuOm5ubw4cffohqtYrJyckNEZzWi/U/e/Ys3njjDQekppA1navtSaOO3Ojo6ItMLCl5q9X0vP57VDgxSS19//338d5772H//v2oVquJ4IR8fOXKFfzyl7/En//8ZzSbzYRbp7Mp1G4aPoLdbDaxurqaeM0SNUizZ7rthS4yZGqBb7crFAq4e/curl27hnw+39/vKGVW58qVKzh69CguX76coATrWSnVKNA2VnB7k6orxneRaADAmQT6kdTwubk5/OhH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CmqEUoBmg+hZ8SyGWixs7Wz1D0j6BS1DZoitoacYCtuGsTRzjGSdcENc7y8qFQqufCXrp7O/PJ5Z99PvhObgHie53LIrKwuYVVwFfQ0KtFy1U9moKArhFgGtZ2UoE9mKR2Rn9k+femwApxWLwCJ9vGezD4WCgXnh1O7/w833qqlH88jNQAAAABJRU5ErkJggg==";
  const 头条爱心图片2 =
    "data:image/png;base64," +
    "iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAA0uSURBVHic3V3pcuK8Ej1eWJLJXpOqef+nC5VkAhgMXiTdH5lWmkaSd5LvnioqBLxIR63Ti20RHY9HAw+MMTDGQGsNANBawxiDKIoQxzGSJMFsNkMURYiiyHcYL6IogtYadV2jqip7/DiOz45JnxljbFs4tNZQSiGKIiRJgjRNMZvNEMdx53bxY1ZVBaUUtNbQWtu+U9uonaH+G2MQ+YimThPRWmtLbpqmSJLk7OB9yKb9iPC6rqGUsoRzouI4PiOY2kjbz+dzpGnauy0+KKVQlqUlXRLO30ucEU3WwhtPHYvjGLPZzEkwR1/LJpBlVlWFuq4bO6C1ttabJMkgC26Duq5RliXqurZkAzizcglLtEsitNZWHrpaCd+WBrDN/rSNMQZFUVgrd+1LbZvP56NbcAhaa5RlaeWOSHaRTkiBLwsGcDI10jS1U5G+7wLSc9dnru/491EUYblcoqoqO+ikwTS76HVpxHGMxWKBOI5RlqWVVmMMkiQ5Id/uQ50wxpyRvFgskKbpoEa5BohLlG8f+m42m+H6+hqz2cxa92w2w2Kx+BaSCVEUYT6f4+rqys524hE4d9YpfeCy5CRJejeEk8ijBf5ZWyRJguVyaSVkuVxOrsVtkSQJFosFoiiyUkKzjiwb+CcdTST3kQ0On1VLCQnJSRzHuLm5AYAfQzIhSRLM53MYY1DXteUSgCU7pn/aWjKf1l3gsmopIbSNT1q47g0d/LFBls1lBPgKMmKlFADYGLSttXQlvGnb0PFcg/QTQWSTbBC3x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tZBeS3ApBv4PcUSrm4hBVzTEY0wVdmJWuWUkKPeVxdXeH6+vosdZdJSVEUOBwOOBwOKMvy7IoIJ5pbcN8opi8mJxoIky2hlEJRFCjLEnme25+Q4hdAqY5SFAWUUva3T3jiwcnlr0tbMsH7M3tTwJiv51HoR3aM+bw5hV70c3v8B9KAUydK1swHTt4yS2Rzgmm7oZYcqn/7cBGL5pDFKPp5ErI0pdRJhbCua29aTqRxQvm9FjKdHoPkvrgo0U2XsYgIqd0h8FuyiHT+OT/vd5EMfINFS1CNhFs3T92lnvIfsqS/tA9ZMbfc79JkiYtqtAtct4Ev7ZbbAF/3knDHyDFmoT6EPhr97UQTXD/94dJnApcJ13dTWvF/whn6wCuA1IH5fO595lGCJ0g/QSokfgzRBEkSD+eSJDl7slda73c6vBB+HNESkvhLXFGfAj9vjv2f4n9pIrYTzwZvEwAAAABJRU5ErkJggg==";
  const 头条关注图片 =
    "data:image/png;base64," +
    "iVBORw0KGgoAAAANSUhEUgAAAB4AAAAoCAYAAADpE0oSAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAD5SURBVFiF7ZY9DoMwDIUfFRMZmLzDCisH8MQNsnOUXIKdS7DDzM7MJczaDhVIlQqBUvU3b4ti61PsPCdenudnpRR838cr5Ydh+FLgpNNbqA7swA7swA68R4efJGaG1hoAUFUVuq7blHf4xMwMIgIRgZk35z211Eqp94D3yIF/H+xprc9rAcyMLMsWb2wURfOeiGAYhrtxIoK2bWefWwdIURQIgsAWBuBqpzRNF/fjOJ7Bnzsyy7IEM6+WeqrIOI6rpW6aZl5be2yTMQZJkgAA+r6HMWZT3v/ZyYG/Eywim2MPf33qugYRAcCNT2067ONH9Rs9duCPBF8AZkk/ewIPuJUAAAAASUVORK5CYII=";

  findAndClick("今日头条助力");
  if (str == "关注" && findAndClick("关注") && 开始任务()) {
    if (!widgetCheck("关注")) {
      if (findAndClick("允许|打开看看|打开")) {
        findAndClick("允许|打开");
      }
    }
    sleep(1000);
    let 关注 = widgetGetOne("作者：.*|私信", 5000);
    if (关注 && 关注.text() == "私信") {
      let 点击关注 = className("android.widget.Button").textEndsWith("关注").findOne(5000);
      if (点击关注) {
        clickCenter(点击关注);
      }
    } else if (关注) {
      clickCenter(关注);
      sleep(1000);
      let 点击关注 = className("android.widget.Button").textEndsWith("关注").findOne(5000);
      if (点击关注) {
        clickCenter(点击关注);
      }
    } else {
      找图(头条关注图片);
      sleep(1000);
      找图(头条关注图片);
      sleep(1000);
    }

    // let 关注位置 = findAndClick("关注");
    if (!widgetGetOne("已关注")) {
      showFLog("没查询到已经关注，用找图");
      findAndClick("关注");
    }

    截图();
    sleep(2000);
    if (findAndClick("已关注")) {
      findAndClick("取消关注");
      back();
      sleep(500);
    }
  }
  if (str == "点爱心" && findAndClick("点爱心") && 开始任务()) {
    sleep(5000);
    if (!找图(头条爱心图片2)) {
      找图(头条爱心图片);
    }
    截图();
  }
  if (str == "收藏" && findAndClick("收藏") && 开始任务()) {
    sleep(5000);
    if (!找图(头条收藏图片2)) {
      找图(头条收藏图片);
    }
    截图();
  }
  if (currentPackage() == "com.bjwhx.and.renren") {
    showFLog("还在人人帮 可能没任务");
    return back();
  }
  back();
  sleep(2000);
  校验人人帮();
  if (人人帮上传()) {
    findAndClick("今日头条助力");
    人人帮上传();
  }
  back();
}

function 开始任务() {
  let 有吗 = findAndClick("开始任务|.*10..");
  if (有吗 && 有吗.text() == "开始任务") {
    if (findAndClick("允许|打开看看|打开|打开App", 8000, 3000)) {
      findAndClick("允许|打开", 5000, 3000);
    }
    //校验打开没有

    let 打开看看 =
      "data:image/png;base64," +
      "iVBORw0KGgoAAAANSUhEUgAAAMgAAABQCAYAAABcbTqwAAAAAXNSR0IArs4c6QAAAARzQklUCAgICHwIZIgAAAvySURBVHic7Z17bFPlG8e/3XpZ3dqzMVQqm6JzypARZsCweSGZzoVojAYTMBEEE00WIniJssjdbF6iieI/TVQcbhEyqYap2ViEOZxR0KlMIG6wDrMh3WQVulPWyzr6+4PfCme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78fJpMJPT09EWnr6uqC0+nExo0bMTo6iu3btwd9XweLNDY2Rj0Z98UXX8io6CqsalP09vZ6I9l5O9nQarXIyspCRkYG7Ha7qHyKcJSUlGB4eBgXLlyQQWFsubbz6nQ6Zfn+csGytikUXq/Xu2PHDqbfU0gQiSIDgN8mAARBXCEDAO666y5Z3+9HEKmCb1Jg1apVMR2hIIhkxGcQg8Hg9+Ymgkh3BIsVV6xYgdLS0kRpIQjm8FvNW1NTQ49aBPF//AxSVFTklytMEOlKwHyQZcuW4fHHH4+3FoJgjqAJUzU1NVGtriSIVCBkRuGmTZuo006kNSENolQqsW3bNsydOzdeegiCKcLmpOt0OtTV1dGdhEhLFF6RySAejwf19fW0qJFIK0QbZAqj0ZjUu1QQRCREbBAAaGtrw86dO5nJRCSIWCHJIABgNpthNBpx/PhxuTURBDNINsgUzc3NaGhooLsJkZJEbRAAsFgsaGpqwqFDh+TQRBDMIItBpjh58iRMJhONdBEpg6wGmaKvrw+tra1ob2+nRy8iKVEoFKiuro6NQabgeR4dHR3o6uqizjyRFJSWluL+++9HZWUldDpdbA1yLefPn0d3dzf++OMPnDhxAlarNR7NEkRI8vPzMX/+fJSVlWHRokV+mxb+D1FNbxrVpRHtAAAAAElFTkSuQmCC";

    if (找图(打开看看)) {
      if (!findAndClick("允许|打开", 5000, 3000)) {
        找图(打开看看);
        findAndClick("允许|打开", 5000, 1000);
      }
    }
    return true;
  }
}
function 打开微信页面(链接) {
  showFLog("打开微信");
  app.startActivity({
    className: "com.tencent.mm.ui.LauncherUI",
    packageName: "com.tencent.mm",
  });
  widgetGetOne("我");
  if (!idAndClick("com.tencent.mm:id/h6y")) {
    log("没查询到首页控件，返回2次");
    back();
    if (!widgetGetOne("我", 5000)) {
      back();
      if (!widgetGetOne("我", 5000)) {
        back();
      }
    }
    idAndClick("com.tencent.mm:id/h6y");
  }
  findAndClick("文件传输助手");
  input(链接);
  sleep(1000);
  findAndClick("发送");
  sleep(1000);
  let 人人帮 = text("人人帮").find();
  for (var i in 人人帮) {
    if (i == 人人帮.length - 1) {
      clickCenter(人人帮[i]);
    }
  }
}
function idAndClick(str, sleepTime) {
  sleepTime = sleepTime || 8000;
  let widgetGet = widgetGetById(str, sleepTime);
  if (widgetGet) {
    clickView(widgetGet);
    return widgetGet;
  }
  return false;
}
function 循环30() {
  for (let i = 0; i < 30; i++) {
    sleep(3000);
    从下往上滑动();
    sleep(3000);
    从下往上滑动();
    sleep(3000);
    从下往上滑动();
    sleep(3000);
    back();
    showFLog("浏览第：" + i + " 次");
    if (currentPackage() != "com.tencent.mm" || className("android.widget.TextView").textMatches("您的阅读暂").findOne(1000)) {
      showFLog("当前应用不是微信或阅读受限退出任务");
      退出();
      log(currentPackage());
      break;
    }
  }
}

function 从下往上滑动(阅读文章速度) {
  log(arguments.callee.name + "开始");
  var 阅读文章速度 = 阅读文章速度 || 2.5;
  var w = device.width;
  var h = device.height;
  var x1 = Math.floor((w / 5) * 2);
  var y1 = Math.floor((h / 5) * 4);
  var x2 = Math.floor((w / 5) * 1);
  var y2 = Math.floor((h / 5) * 阅读文章速度);
  var duration = 300;
  log("滑动参数=", x1, y1, x2, y2, duration);
  swipeRnd(x1, y1, x2, y2, duration);
  log(arguments.callee.name + "结束");
  sleep(3000);
}
function swipeRnd(x1, y1, x2, y2, duration) {
  log(arguments.callee.name + "开始");
  var k = 20;
  var x1 = x1 + random(-k, k);
  var y1 = y1 + random(-k, k);
  var x2 = x2 + random(-k, k);
  var y2 = y2 + random(-k, k);
  var duration = duration + random(-k, k);
  swipeRnd2(x1, y1, x2, y2, duration);
}

function swipeRnd2(x1, y1, x2, y2, duration) {
  gesture(duration, [x1, y1], [x1 + 60, y1 - 80], [x2, y2]);
}

function 退出() {
  back();
  sleep(1000);
  back();
  sleep(1000);
  back();
}

function 阅读() {
  if (findAndClick("阅读助力")) {
    findAndClick("复制");
    sleep(1000);
    if (launchApp("Hamibot")) {
      if (!getClip()) {
        launchApp("困鱼");
      }
    } else {
      log("打开Hamibot失败");
      launchApp("困鱼");
    }
    sleep(1000);
    let 链接 = getClip().split(" ")[0];
    log("<a href='%s' >人人帮</a>", 链接);
    链接 = "<a href='" + 链接 + "' >人人帮</a>";
    打开微信页面(链接);
    if (findAndClick("开始阅读")) {
      sleep(3000);
      if (widgetGetOne("阅读更新中|开始阅读|人人帮|您的阅读.*") || className("android.widget.TextView").text("赚钱流程").findOne(1000)) {
        showFLog("现在不能阅读");
        yd = fasle;
      } else {
        循环30();
      }
    }

    退出();
  }
}
function 取消关注公众号() {
  toastLog("请到公众号页面后运行");
  console.setPosition(0, height * 0.65);
  console.show();
  let gzhu = className("android.widget.TextView").find();
  let i = 100;
  while (gzhu.length > 2 && 100 > 0) {
    if (gzhu.length > 2) {
      press(gzhu[2].bounds().centerX(), gzhu[2].bounds().centerY(), 800);
      log(gzhu[2].text() + " 不关注");
      findAndClick("不再关注", 8000, 1000);
      findAndClick("不再关注", 8000, 1000);
      sleep(3000);
    }
    gzhu = className("android.widget.TextView").find();
    i--;
  }
}
function 文件传输方法() {
  if (!widgetCheck("选择一个聊天")) {
    findAndClick("发送");
  }
  findAndClick("文件传输助手");
  findAndClick("发送");
  widgetCheck(":");
  sleep(2000);
  showFLog("点击固定位置");
  click(800, 1800);
  sleep(2000);
  if (!press(600, 1250, 700)) {
    showFLog("长按识别失败，重新按");
    press(600, 1000, 700);
  }
  findAndClick(".*二维码", 8000, 2000);

  if (findAndClick("关注公众号", 8000, 3000)) {
    sleep(2000);
    if (!widgetGetOne("已关注公众号")) {
      back();
    }
  }
}
